package org.example.manager.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.example.manager.AccountManager;
import org.example.mapper.AccountMapper;
import org.example.model.AccountDO;
import org.example.service.AccountService;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: 谢超
 * @date: 2023/07/16 20:19
 **/
@Component
@Slf4j
public class AccountManagerImpl implements AccountManager {

    @Resource
    private AccountMapper accountMapper;

    @Override
    public int insert(AccountDO accountDO) {

        return accountMapper.insert(accountDO);
    }

    @Override
    public List<AccountDO> findByPhone(String phone) {
        List<AccountDO> accountList = accountMapper.selectList(Wrappers.lambdaQuery(AccountDO.class).eq(AccountDO::getPhone, phone));

        return accountList;
    }
}
